-
Notifications
You must be signed in to change notification settings - Fork 203
Fix SDO truncation of unknown datatypes #447
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix SDO truncation of unknown datatypes #447
Conversation
(It fails checks because it depends on |
af98492
to
49e4a73
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅ 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've replied to the discussion in #436 concerning the approach taken here. Will come up with a less intrusive suggestion shortly.
logger.warning(f"Decoding data {data!r} of type 0x%X at %s", | ||
self.data_type, pretty_index(self.index, self.subindex)) | ||
logger.warning(f"Size: {size} bytes, data length: {len(data)} bytes") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is definitely too much logging, both by number of messages and at a too high severity level.
And please try to stick to the previously discussed rule: logging
methods use %
formats and parameters, and f-strings for everything else.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I agree. These are left-overs from my own debugging. My bad. I'll remove them.
pretty_index(self.index, self.subindex), self.data_type, | ||
size, len(data)) | ||
# Truncate the data to the expected size | ||
data = data[:size] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's way easier switching to the .unpack_from()
method which simply discards trailing extra data. I don't think this severe warning is generally desired.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm going to remove the warning altogether.
Superseded by #591. Closing |
This is a proposed fix for #436